    package cn.com.nes.site.controller.maintenanceReminder;

    import cn.com.nes.common.web.CommonResult;
    import cn.com.nes.site.entity.vo.maintenanceReminder.MaintenanceReminderVo;
    import cn.com.nes.site.service.maintenanceReminder.MaintenanceReminderService;
    import io.swagger.annotations.Api;
    import org.springframework.stereotype.Controller;
    import org.springframework.validation.annotation.Validated;
    import org.springframework.web.bind.annotation.*;
    import javax.annotation.Resource;

    /**
     * 设备巡检相关信息
     *
     * @author nes
     * @date 2018-11-10 21:22
     */
    @Api(tags = {"增加维保信息"})
    @Controller
    @RequestMapping("/v2/maintenanceReminder")
    public class MaintenanceReminderController {
        @Resource
        private MaintenanceReminderService maintenanceReminderService;


        @RequestMapping(value = "/addMaintenanceReminder", method = RequestMethod.POST)
        @ResponseBody
        public CommonResult<?> addMaintenanceReminder(@RequestBody @Validated MaintenanceReminderVo vo) {

            Integer res = maintenanceReminderService.addMaintenanceReminder(vo);
            if (res > 0) {
                return CommonResult.ok();
            } else {
                return CommonResult.error("保存失败");
            }

        }

        @RequestMapping(value = "/updateMaintenanceReminder", method = RequestMethod.POST)
        @ResponseBody
        public CommonResult<?> updateMaintenanceReminder(@RequestBody @Validated MaintenanceReminderVo vo) {

            Integer res = maintenanceReminderService.updateMaintenanceReminder(vo);
            if (res > 0) {
                return CommonResult.ok();
            } else {
                return CommonResult.error("保存失败");
            }

        }

        @RequestMapping(value = "/queryMaintenanceReminder", method = RequestMethod.POST)
        @ResponseBody
        public CommonResult<?> queryMaintenanceReminder(@RequestBody @Validated MaintenanceReminderVo vo) {
            return CommonResult.page(maintenanceReminderService.queryMaintenanceReminder(vo));
        }

        @RequestMapping(value = "/deleteMaintenanceReminderById", method = RequestMethod.POST)
        @ResponseBody
        public CommonResult<?> deleteMaintenanceReminderById(@RequestBody @Validated MaintenanceReminderVo vo) {
            Integer res = maintenanceReminderService.deleteMaintenanceReminderById(vo);
            if (res > 0) {
                return CommonResult.ok();
            } else {
                return CommonResult.error("删除失败");
            }
        }

    }
